import { Channel } from '@/types/data'
import { HomeAction } from '@/types/store'

type HomeType = {
  userChannels: Channel[]
}

const initValue: HomeType = {
  userChannels: []
}

export default function home (state = initValue, action: HomeAction): HomeType {
  if (action.type === 'home/saveUserChannels') {
    return {
      ...state,
      userChannels: action.payload
    }
  }
  return state
}
